#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "tcp.h"
#include "tunnel.h"


int main(int argc, char *argv[])
{
    if (argc != 2) {
        printf("./demo [port]\n");
        return -1;
    }

    tcp_t cli = {
        .addr = "127.0.0.1",
        .port = atoi(argv[1]),
    };

    if (tcp_new_cli(&cli) < 0) {
        printf("create client failed!\n");
        return -1;
    }

    //sendbuf(cli.sock, msg, strlen(msg));

    char buf[1024] = {0};
    memset(buf, 0, sizeof(buf));

    tunl_t tnl = {
        .active = TUNL_REQ_ACTIVE_YES,
        .number = 1024,
    };
    tunl_set_req(buf, &tnl);
    sendbuf(cli.sock, buf, strlen(buf));

    getchar();

    return 0;
}
